package com.chenss.dragonserapp.activity;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.chenss.dragonserapp.R;
import com.chenss.dragonserapp.app.AppInfo;
import com.chenss.dragonserapp.app.Constant;
import com.chenss.dragonserapp.base.BaseActivity;

/**
 * PageName: 启动页面
 * Create by chenss at 2018/4/20 2:54
 */
public class StartActivity extends BaseActivity {
TextView tv_pot;
    @Override
    public void initParms(Bundle parms) {

    }

    @Override
    public int bindLayout() {
        return R.layout.activity_start;
    }

    @Override
    public void initView(View view) {
        tv_pot=findView(R.id.tv_pot);
    }

    @Override
    public void doBusiness(Context mContext) {
        time1 = System.currentTimeMillis();
        mHandler.sendEmptyMessageDelayed(110, 500);
    }

    @Override
    public void widgetClick(View v) {

    }

    long time1 = 0;
    private Handler mHandler = new Handler() {
        public void handleMessage(Message msg) {
            if (System.currentTimeMillis() - time1 < 3000) {
                String s=tv_pot.getText().toString();
                tv_pot.setText(s+".");
                mHandler.sendEmptyMessageDelayed(110, 500);
            }else{
                if(null!= AppInfo.getUser(StartActivity.this)&& !TextUtils.isEmpty( AppInfo.getUser(StartActivity.this).getStore_id())){
                    startActivity(MainActivity.class);
                }else{
                    startActivity(LoginActivity.class);
                }
                finish();
            }
        }

        ;
    };


}
